﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NIEN_LUAN
{
    public partial class FormReportChiTietPhieuThu : Form
    {
        private Db.DataContentDataContext db = new NIEN_LUAN.Db.DataContentDataContext();
        public FormLapPhieuThu frmThongkephieuthu;

        public FormReportChiTietPhieuThu()
        {
            InitializeComponent();
        }

        public FormReportChiTietPhieuThu(FormLapPhieuThu frm)
        {
            InitializeComponent();
            this.frmThongkephieuthu = frm;
        }

        private void FormReportChiTietPhieuThu_Load(object sender, EventArgs e)
        {
            var phieuthu = (from m in db.PHIEUTHUs
                            //where here
                            //ở đ^ay anh select v^ề 1 chung tu thong ke
                            select new Db.Chitietchungtuthongke
                            {

                                NgayLap = m.NgayLap ?? DateTime.Now,//neu ngay lap ma null thi lay ngay hien tai
                                SoChungTu = m.SoChungTu,
                                TenNhanVienLap = m.NHANVIEN.TenNhanVien,
                                TenKhachHang = m.CHUNGTU.KHACHHANG.TenKhachHang,
                                SoPhieuThu = m.SoPhieuThu,
                                SoTien = m.SoTien ?? 0,
                                MaNhanVien = m.NHANVIEN.MaNhanVien,                                                                                           
                                DiaChi=m.CHUNGTU.KHACHHANG.DiaChi,
                                SDT=m.CHUNGTU.KHACHHANG.SoDienThoai 
                            }).ToList();
            this.BindingSource.DataSource = phieuthu;
            this.reportViewer1.RefreshReport();
        }
    }
}
